//index.js
//获取应用实例
import bxios from '../../utils/Bxios'
const app = getApp()

Page({
  data: {
    power:true
  },
  onLoad: function () {
    this.animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'linear'
    })
    this.animation2 = wx.createAnimation({
      duration: 1000,
      timingFunction: 'linear'
    })
    this.circleAni = wx.createAnimation({
      duration: 1000,
      timingFunction: 'linear'
    })
    this.powerAni = wx.createAnimation({
      duration: 500,
      timingFunction: 'linear'
    })
  },
  onReady(){
    this.animation.translateX(10).step();
    this.animation.translateX(0).step();
    this.animation2.translateX(-10).step();
    this.animation2.translateX(0).step();
    this.circleAni.translateY(-20).step()
    this.circleAni.translateY(0).step()

    this.setData({
      animation: this.animation.export(),
      animation2: this.animation2.export(),
      circleAni: this.circleAni.export()
    })
  },
  change(){
    switch (this.data.power) {
      case true:
        this.powerAni.backgroundColor('#FF3366').step()
        this.setData({
          powerAni: this.powerAni.export(),
          power: false
        })
        break;
      case false:
        this.powerAni.backgroundColor('#03d2ca').step()
        this.setData({
          powerAni: this.powerAni.export(),
          power: true
        })
      break;
    }
    
  }
})
